/*
 * File:   tourney.cpp
 * Author: g0dragon
 *
 * Created on April 3, 2012, 10:17 PM
 */

#include <iostream>
#include <string>
#include <cstdlib>
#include <../include/tourney.h>
#include <../include/format.h>
#include <../include/member.h>
#include <../include/date.h>
using namespace std;

/* Tournament Object */
/**
 * 
 * @param name
 * @param sport
 * @param formatType
 * @param startdate
 * @param enddate
 * @param deadline
 * @param contactInfo
 * @param details
 */
Tourney::Tourney(string name, string sport, int formatType,
        Date startdate, Date enddate, Date deadline,
        struct contact contactInfo, struct contact location, string details) {
    editName(name);
    editSport(sport);
    editDates(startdate, enddate, deadline);
    editContact(contactInfo);
    editLocation(location);
    editDetails(details);
}

/* Information Gathering */

/**
 *
 * @return
 */
string Tourney::getName() {
    return Tourney.name;
}

/**
 *
 * @return the current sport of the tournament
 */
string Tourney::getSport() {
    return Tourney.sport;
}

/**
 * 
 * @return a list of the start and end dates and deadline
 */
list <Date> Tourney::getDates() {
    return(startDate, endDate, deadline);
}

/**
 * Get all contact info at once
 * In contactInfo
 * @return information to contact tournament staff
 */
struct contact Tourney::getContact(){
    return Tourney.contactinfo;
}

/**
 * 
 * @return information of the location of tournament
 */
struct contact Tourney::getLocation(){
    return Tourney.contactinfo;
}

/**
 * 
 * @return
 */
string Tourney::getDetails(){
    return Tourney.details;
}


/* User-enabled editting */

/**
 *
 * @param newName
 */
void Tourney::editName(int newName){
    Tourney.name = newName;
}

/**
 * 
 * @param newSport
 */
void Tourney::editSport(int newSport){
    Tourney.sport = newSport;
}

/**
 * deficiency is subtle
 * @param start
 * @param end
 * @param deadline
 */
void Tourney::editDates(Date start, Date end, Date deadline){
    if (start!= NULL){
        Tourney.startDate = start;
    }
    if (end!= NULL){
        Tourney.endDate = end;
    }
    if (deadline!= NULL){
        Tourney.deadline = deadline;
    }
}

void Tourney::editContact(contact contactInfo){
    Tourney.contactinfo = contactInfo;
}

void Tourney::editDetails(string newdetail){
    Tourney.details = newdetail;
}

